<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    *{
      margin: 0;
      padding: 0;
    }
    .title{
      width: 80px;
      text-align: right;
    }
    .title::after{
      content: "： ";
    }
    .flex{
      display: flex;
      align-items: center;
    }
    span{
      cursor: pointer;
    }
  </style>
</head>
<body>
  <div id="app">
    <div>
      <ul>
        <li class="flex">
          <div class="title">姓名</div>
          <div>
            <div v-if="isEdit">
              <input type="text" v-model="name">
              <button @click="isEdit = false">确定</button>
              <button @click="cancel">取消</button>
            </div>
            <span @dblclick="edit" v-else>{{name}}</span>
          </div>
        </li>
      </ul>
    </div>
  </div>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
  new Vue({
    el:'#app',
    data() {
      return {
        isEdit:false,
        name:'张三',
        backName:''
      }
    },
    methods:{
      edit(){
        this.isEdit = true
        this.backName = this.name
      },
      cancel(){
        this.name = this.backName
        this.isEdit = false
      }
    }
  })
</script>
</html>